﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include "GmStructure.h"
#include "StructureInstanceInput.h"
#include "IPolygon.h"
#include "StructureSlopeDefinitionType.h"
#include "GbmpBuiltInParameterStaticVauleListItems.h"

namespace gcmp
{
    class IModelLine;
    class IStructureSlopeLine;
    struct StructureFloorSlopeLineInput;

    //根据几何信息创建板的输入数据
    struct StructureProfileInstanceGeometryInput :public StructureInstanceInput
    {
        StructureProfileInstanceGeometryInput()
        {
            ProfilePolygon = nullptr;
            FloorSlopeLine = nullptr;
            AssociatedPlaneOffset = 0.0;
            ConcreteType = ConcreteStrengthGradeType::CSG_C30;
        }
        OwnerPtr<IPolygon> ProfilePolygon;
        OwnerPtr<StructureFloorSlopeLineInput> FloorSlopeLine;
        double AssociatedPlaneOffset;
        ConcreteStrengthGradeType ConcreteType;
    };

    //根据现有Element创建板的输入数据
    struct StructureProfileInstanceElementInput :public StructureInstanceInput
    {
        StructureProfileInstanceElementInput()
        {
            FloorSlopeLine = nullptr;
            AssociatedPlaneOffset = 0.0;
            ConcreteType = ConcreteStrengthGradeType::CSG_C30;
        }
        std::vector<IModelLine*> ProfileCurves;
        IStructureSlopeLine* FloorSlopeLine;
        double AssociatedPlaneOffset;
        ConcreteStrengthGradeType ConcreteType;
    };

    //根据几何信息创建筏板的输入数据
    struct StructureRaftFoundationGeometryInput :public StructureProfileInstanceGeometryInput
    {
        StructureRaftFoundationGeometryInput()
        {
            ZPositioningType = RaftFoundationZPositioningType::Top;
        }
        RaftFoundationZPositioningType ZPositioningType;
    };

    //根据现有Element创建筏板的输入数据
    struct StructureRaftFoundationElementInput :public StructureProfileInstanceElementInput
    {
        StructureRaftFoundationElementInput()
        {
            ZPositioningType = RaftFoundationZPositioningType::Top;
        }
        RaftFoundationZPositioningType ZPositioningType;
    };

    //根据几何信息编辑板的输入数据
    struct StructureProfileInstanceEditGeometryInput
    {
        StructureProfileInstanceEditGeometryInput()
        {
            Document = nullptr;
            ProfilePolygon = nullptr;
            FloorSlopeLine = nullptr;
            InstanceId = ElementId::InvalidID;
        }
        IDocument* Document;
        OwnerPtr<IPolygon> ProfilePolygon;
        OwnerPtr<StructureFloorSlopeLineInput> FloorSlopeLine;
        ElementId InstanceId;
    };

    //根据现有Element编辑板的输入数据
    struct StructureProfileInstanceEditElementInput
    {
        StructureProfileInstanceEditElementInput()
        {
            FloorSlopeLine = nullptr;
            Document = nullptr;
            InstanceId = ElementId::InvalidID;
        }
        IDocument* Document;
        std::vector<IModelLine*> ProfileCurves;
        IStructureSlopeLine* FloorSlopeLine;
        ElementId InstanceId;
    };

    //创建坡度线的几何输入信息
    struct StructureFloorSlopeLineInput
    {
        StructureFloorSlopeLineInput()
        {
            DefinitionType = StructureSlopeDefinitionType::ElevationDifference;
            StartPoint = Vector2d::Create(0,0);
            EndPoint = Vector2d::Create(0,0);
            StartElevationOffset = 0.0;
            EndElevationOffset = 0.0;
            SlopeAngle = 0.0;
        }
        StructureSlopeDefinitionType DefinitionType;       // 坡度线定义方式
        Vector2d StartPoint;                               // 坡度线在平面投影的起点
        Vector2d EndPoint;                                 // 坡度线在平面投影的终点
        double StartElevationOffset;                       // 坡度线起点高度（相对于楼板定位面）
        double EndElevationOffset;                         // 坡度线终点高度（相对于楼板定位面）
        double SlopeAngle;                                 // 楼板坡度角(弧度)
    };
}
